<!DOCTYPE html  >
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<head th:include="/base/common_css('test')">


<body>
<div th:include="/base/common_banner"></div>

<!-- Header ends -->
<!-- Main content starts -->

<div class="content">

    <!-- Sidebar -->
    <!--menu ????-->
    <div th:include="/base/common_menu"></div>
    <!--menu????-->
    <!-- Sidebar ends -->

    <!-- Main bar -->
    <div class="mainbar">

        <!-- Page heading -->
        <div th:include="/base/common_pageHeader"></div>
        <!-- Page heading ends -->

        <div class="matter">
            <div class="container">

                <!--按条件查询-->
                <div class="panel panel-default">

                    <div class="panel-body">

                        <form id="formSearch" class="form-horizontal">
                            <div class="form-group" style="margin-top:20px">
                                <div class="col-sm-1">
                                    <lable class="control-label" style="font-size: large; color:#3c763d">分组管理</lable>
                                </div>
                                <div class="col-sm-1">
                                    <label href="/view/groupList?pageNumber=1&pageSize=10" style="background: rgb(96, 97, 93)" ><span style="font-size: 15px;color:#fdfff4">分组列表</span></label>
                                </div>
                                <div class="col-sm-2" style="text-align:left;">
                                    <a href="/view/saveGroups"  class="btn btn-dafault btn-sm"><span style="font-size: 15px;color:#60615d">新增</span></a>
                                </div>
                            </div>
                            <div class="form-group" style="margin-top:10px">
                                <label class="control-label col-sm-1" for="groupName">分组名称</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="groupName">
                                </div>
                                <label class="control-label col-sm-1" for="isShow">状态</label>
                                <div class="col-sm-2">
                                    <select id="isShow" th:value="${isShow}"
                                            class="selectpicker show-tick form-control">
                                        <option>---不限---</option>
                                        <option value="1">显示</option>
                                        <option value="0">隐藏</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group" style="margin-top:10px">
                                <label class="control-label col-sm-1">结果排序</label>
                                <div class="col-sm-1">
                                    <select id="rankType" name="rankType" class="selectpicker show-tick form-control">
                                        <option>默认排序</option>
                                        <option value="sort">序号</option>
                                        <option value="createTime">创建时间</option>
                                    </select>
                                </div>
                                <div class="col-sm-1">
                                    <select id="orderType" name="orderType" class="selectpicker show-tick form-control">
                                        <option value="desc">逆序</option>
                                        <option value="asc">正序</option>
                                    </select>
                                </div>

                                <div class="col-sm-4" style="text-align:left;">
                                    <button type="button" style="margin-left:10px" class="btn btn-primary btn_search"
                                            onclick="serachGroup()">查询
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>

                </div>


                <div class="row">
                    <div class="col-md-10">
                        <div class="widget">
                            <div class="widget-head" style="background: rgb(237, 237, 237)">
                                <div class="pull-left" >分组列表</div>
                                <div class="clearfix"></div>
                            </div>
                            <!--批量操作-->
                            <div class="form-group" style="margin-top:20px">

                                <div class="btn-toolbar" role="toolbar">
                                    <div class="btn-group" style="margin-left: 15px">
                                        <button type="button" class="btn btn-default btn-sm">显示</button>
                                    </div>
                                    <div class="btn-group" style="margin-left: 15px">
                                        <button type="button" class="btn btn-default btn-sm">隐藏</button>
                                    </div>
                                    <div class="btn-group" style="margin-left: 15px">
                                        <button type="button" class="btn btn-default btn-sm">删除</button>
                                    </div>
                                    <div class="col-sm-1">
                                        <select id="sort" name="sort"
                                                class="selectpicker show-tick form-control">
                                            <option>排序</option>
                                            <option th:each="obj:${groupList.list}"
                                                    th:value="${obj.sort}"
                                                    th:text="${obj.sort}"
                                                    th:selected="${obj.sort == sort}"></option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="widget-content medias">
                                <table border="1" class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr style="background: rgb(208, 208, 208)">
                                        <th>
                            <span class="uni">
                              <input type='checkbox' value='check1'/>全选
                            </span>
                                        <th>序号</th>
                                        <th>分组名</th>
                                        <th>分组描述</th>
                                        <th>状态</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    <tbody>
                                    <tr th:each="obj,objStat:${groupList.list}">
                                        <th>
                            <span class="uni">
                              <input type='checkbox' value='check1'/>
                            </span>
                                        <td th:text="${obj.sort}">123</td>
                                        <td th:text="${obj.groupName}">123</td>
                                        <td th:text="${obj.groupDescription}">123</td>
                                        <td th:text="${obj.isShow}? '显示':'隐藏'">123</td>
                                        <td th:text="${#dates.format(obj.createTime,'yyyy-MM-dd')}">123</td>
                                        <td>
                                            <a th:href="@{'/view/saveGroups?groupId='+${obj.groupId}}"
                                               class="btn btn-success">修改</a>&nbsp;&nbsp;&nbsp;
                                            <!--<a th:href="@{'/view/deleteGroups?groupId='+${obj.groupId}}" class="btn btn-danger">删除</a>-->
                                        </td>
                                    </tr>
                                    </tbody>
                                    </thead>
                                </table>
                                <!--批量操作-->
                                <div class="form-group" style="margin-top:20px">

                                    <div class="btn-toolbar" role="toolbar">
                                        <div class="btn-group" style="margin-left: 15px">
                                            <button type="button" class="btn btn-default btn-sm">显示</button>
                                        </div>
                                        <div class="btn-group" style="margin-left: 15px">
                                            <button type="button" class="btn btn-default btn-sm">隐藏</button>
                                        </div>
                                        <div class="btn-group" style="margin-left: 15px">
                                            <button type="button" class="btn btn-default btn-sm">删除</button>
                                        </div>
                                        <div class="col-sm-1">
                                            <select id="sort1" name="sort"
                                                    class="selectpicker show-tick form-control">
                                                <option>排序</option>
                                                <option th:each="obj:${groupList.list}"
                                                        th:value="${obj.sort}"
                                                        th:text="${obj.sort}"
                                                        th:selected="${obj.sort == sort}"></option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <!--分页-->
                                <div class="widget-foot">
                                    <div id="page1">
                                        <input type="hidden" id="pageNumber" th:value="${groupList.pageNum}">
                                        <input type="hidden" id="pageSize" th:value="${groupList.pageSize}">
                                        <input type="hidden" id="totalPage" th:value="${groupList.pages}">
                                        <input type="hidden" id="total" th:value="${groupList.total}">
                                    </div>
                                </div>
                                <!-- Mainbar ends -->
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>


    </div>
</div>

<!--footer-->
<div th:include="/base/common_footer"></div>
<!---->


<!-- Scroll to top -->
<span class="totop"><a href="#"><i class="icon-chevron-up"></i></a></span>

<!--js????-->
<div th:include="/base/common_js"></div>
<!--js????-->

<!-- Script for this page -->

<script type="text/javascript">
    initPage('page1', '/view/groupList', {}, false);
    function serachGroup() {

        var data = {
            groupName: $('#groupName').val(),
            isShow: $('#isShow').val(),
            rankType: $('#rankType').val(),
            orderType: $('#orderType').val()
        }
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/view/searchGroup?pageNumber=1&pageSize=10",
            data: data,
            success: function (data) {
                var html = "";

                if (null != data && data.data.groupList.list.length > 0) {
                    for (var i = 0; i < data.data.groupList.list.length; i++) {
                        var o = data.data.groupList.list[i];
                        html += "  <tr><td><span class=\"uni\"><input type='checkbox' value='check1'/></span> </td>"
                                + "<td>" + o.sort + "</td>"
                                + "<td>" + o.groupName + "</td>"
                                + "<td>" + o.groupDescription + "</td>"
                                + "<td>" + o.isShow + "</td>"
                                + "<td>" + o.args1 + "</td>"
                                + "<td>" + o.createTime + "</td>"
                                + "<td>编辑</td>";
                    }
                }
                $("tbody").empty().append(html);

                var d = data.data.groupList;
                var temp = '<div id="page2"><input type="hidden" id="pageNumber" value="' + d.pageNum + '">' +
                        '<input type="hidden" id="pageSize" value="' + d.pageSize + '">' +
                        '<input type="hidden" id="totalPage" value="' + d.pages + '">' +
                        '<input type="hidden" id="total" value="' + d.total + '"></div>'
                $(".widget-foot").empty().html(temp);
                initPage('page2', '/view/searchGroup', {}, false);


            }
        });
    }
</script>

</body>
</html>
